package com.barry;

import java.util.concurrent.CountDownLatch;

/**
 * 类功能描述：//TODO
 *
 * @author WangXueXing create at 18-12-4 下午3:20
 * @version 1.0.0
 */
public class CountDownLatchTest {
    CountDownLatch cd = new CountDownLatch(1);
    public void doSomeThing() throws InterruptedException {
        System.out.println("do something...");
        Thread.sleep(2000);
//        cd.countDown();
    }
    public void doSomeThing2() {
        System.out.println("do something2...");
    }

    public static void main(String[] args) throws InterruptedException {
        CountDownLatchTest ct = new CountDownLatchTest();
        ct.doSomeThing();
        new Thread(() -> {
            ct.doSomeThing2();
        }).start();
        ct.cd.await();
    }

}
